package xt.outfood.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import xt.outfood.common.Result;
import xt.outfood.entity.Orders;
import xt.outfood.service.OrderDetailService;
import xt.outfood.service.OrdersService;

/**
 * @author 小小爱欧
 * @date 2022/8/22 16:09
 */
@Slf4j
@RestController
@RequestMapping("/order")
public class OrdersController {
    @Autowired
    private OrdersService ordersService;
    @Autowired
    private OrderDetailService orderDetailService;

    /**
     * 提交下单
     * @param orders
     * @return
     */
    @PostMapping("/submit")
    public Result<String> submit(@RequestBody Orders orders){
        log.info("订单详细信息：{}",orders.toString());
        ordersService.submit(orders);

    return Result.success("订单提交成功");
    }
    @GetMapping("/userPage")
    public Result<Orders> getOrderDetails(){
        return null;
    }
}
